//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	MetaFormButton.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Linq;

namespace Smart.Common.Forms
{
	/// <summary>
	/// Forms button
	/// </summary>
	public class MetaFormButton : MetaFormCtrl
	{
		/// <summary>
		/// Flag whether to use standard image 
		/// </summary>
		public bool UseStandardImage { get; set; }

		/// <summary>
		/// Image Url 16
		/// </summary>
		public string ImageUrl16 { get; set; }

		/// <summary>
		/// Image Url 32
		/// </summary>
		public string ImageUrl32 { get; set; }

		/// <summary>
		/// Image X
		/// </summary>
		public int ImageX { get; set; }

		/// <summary>
		/// Image Y
		/// </summary>
		public int ImageY { get; set; }

		/// <summary>
		/// Standard image language
		/// </summary>
		public int ImageLang { get; set; }

		/// <summary>
		/// Command to execute on click
		/// </summary>
		public string Command { get; set; }

		/// <summary>
		/// Command to execute to check whether command enabled
		/// </summary>
		public string CommandEnable { get; set; }

		/// <summary>
		/// Security
		/// </summary>
		public string[] Security { get; set; }

		/// <summary>
		/// Condition
		/// </summary>
		public string Condition { get; set; }

		/// <summary>
		/// Forms button
		/// </summary>
		public MetaFormButton(string title, string name, string command)
			: base(title, name)
		{
			Command = command;
		}

		/// <summary>
		/// Set security
		/// </summary>
		/// <param name="security">;# splitted string of security</param>
		public virtual void SetSecurity(string security)
		{
			Security = security.SplitAndTrimByCommaOrSemicolonOrLookup();
		}
	}
}